//
//  KKHttpServices.h
//  BurNing
//
//  Created by LIKUN on 15/8/13.
//  Copyright (c) 2015年 LIKUN. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "KKHttpParse.h"

#define TimeOut 30.0
#define AFNetworkNotReachability ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus <= 0)
#define NoNetworkState @""

#define MESSAGE_NoNetwork  @"Network connection failed. Please try again later!"

typedef NS_ENUM(NSInteger, HttpType) {
    HttpTypeGet = 1,
    HttpTypePost,
};


@interface KKHttpServices : AFHTTPSessionManager

typedef void (^KKSuccessBlock)(id responseObject,KKHttpParse *parse);
typedef void (^KKFailureBlock)(KKHttpParse *parse);
typedef void (^KKCancelBlock)(NSURLSessionDataTask *task);
+ (instancetype)shareInstance;
/**
 *  POST请求
 *
 *  @param url          url
 *  @param dic          参数
 *  @param succsssBlock 成功回调
 *  @param failureBlock 失败回调
 */
+ (void)httpPostUrl:(NSString *)url sign:(NSString *)sign prams:(NSDictionary *)dic success:(KKSuccessBlock)succsssBlock failure:(KKFailureBlock)failureBlock cancel:(KKCancelBlock)cancelBlock;

+ (void)httpPostUrl:(NSString *)url prams:(NSDictionary *)dic success:(KKSuccessBlock)succsssBlock failure:(KKFailureBlock)failureBlock cancel:(KKCancelBlock)cancelBlock;

+ (void)postUploadFile:(NSString *)url sign:(NSString *)sign prams:(NSDictionary *)prams thumbnail:(NSData *)tdata thumname:(NSString *)thumname success:(KKSuccessBlock)succsssBlock failure:(KKFailureBlock)failureBlock
                cancel:(KKCancelBlock)cancelBlock;
+(NSString *) creatHttpErr:(KKHttpParse*) param err:(NSError**)err;
@end
